﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SettingView : MonoBehaviour
{
    public Button back;
    public Button customSetting;
    public Button selectMusic;
    public Button sliderSetting;

    public Dropdown keyVibrate_dd;
    public Dropdown sliderVibrate_dd;
    public Dropdown layout_dd;

    public GameObject customLayoutView;
    public GameObject selectMusicView;
    public GameObject sliderSettingView;

    // Start is called before the first frame update
    void Start()
    {
        keyVibrate_dd.value = GameData.keyVibrateIndex;
        sliderVibrate_dd.value = GameData.sliderVibrateIndex;
        layout_dd.value = GameData.layoutIndex;


        back.onClick.AddListener(() => {
            GameData.Save();
            this.gameObject.SetActive(false);
        });

        keyVibrate_dd.onValueChanged.AddListener((value) => {
            GameData.keyVibrateIndex = value;
        });

        sliderVibrate_dd.onValueChanged.AddListener((value) => {
            GameData.sliderVibrateIndex = value;
        });

        layout_dd.onValueChanged.AddListener((value) => {
            GameData.layoutIndex = value;
        });

        customSetting.onClick.AddListener(()=> 
        {
            customLayoutView.SetActive(true);
        });

        selectMusic.onClick.AddListener(()=>
        {
            selectMusicView.SetActive(true);
        });
        sliderSetting.onClick.AddListener(()=> {
            sliderSettingView.SetActive(true);
        });
    }

}
